<template>
    <el-tabs type="border-card" class="mt-10 mb20" @tab-click="handleChangeTabs">
      <el-tab-pane label="移动支付通道" ref="mobile">
        <p class="fz12">当前已选：</p>
        <p>
          <span class="fz12 mr20">微信：<span class="tip">{{ paychannel.wx_open ? '官方通道': paychannel.ws_wx_open ? '网商银行' : paychannel.fu_wx_open ? '富民银行' : paychannel.le_wx_open || paychannel.le_ali_open ? '乐刷' : paychannel.xdl_wx_open ? '新大陆' : '无' }}</span></span>
          <span class="fz12 mr20">支付宝：<span class="tip">{{ paychannel.ali_open ? '官方通道': paychannel.ws_ali_open ? '网商银行' : paychannel.fu_ali_open ? '富民银行' : paychannel.le_ali_open || paychannel.le_wx_open ? '乐刷' : paychannel.xdl_ali_open ? '新大陆' : '无' }}</span></span>
          <span class="fz12 mr20">银联二维码：<span class="tip">{{ paychannel.xdl_norm_open ? '新大陆银联二维码': '无' }}</span></span>
        </p>
        <el-row class="mt20">
          <el-col :span="6">
            <el-menu @select="handDialogMenuActive">
              <el-menu-item v-for="item in menu" :key="item.b_channel_text" :index="item.b_channel_text">
                <svg-icon style="width: 20px;height:20px;vertical-align: middle;" :icon-class="item.b_channel_text === '微信官方' ? 'weixin' : item.b_channel_text === '支付宝官方' ? 'zhifubao' : item.b_channel_text === '网商银行' ? 'wangshang' : item.b_channel_text === '富民银行' ? 'gen' : item.b_channel_text === '乐刷' ? 'le' : item.b_channel_text === '新大陆' ? 'xindalu' : ''"></svg-icon>
                <span>{{ item.b_channel_text }}</span>
              </el-menu-item>
            </el-menu>
          </el-col>
          <el-col :span="17" :offset="1">
            <el-form :model="paychannel" size="mini" :rules="rules" :show-message="false" ref="model">
              <el-form-item v-if="active === '微信官方'" prop="wx">
                <el-checkbox v-model="paychannel.wx_open" class="wx_open" label="微信官方：" @change="handleDialogCheckSelect"></el-checkbox>
                <el-input :disabled="true" class="w100" :maxlength="5" v-model.number="paychannel.wx"></el-input>%
                <p v-if="roles[0] !== 0" class="err">Tips：如需修改，请向上级申请！</p>
              </el-form-item>
              <el-form-item v-if="active === '支付宝官方'" prop="ali">
                <el-checkbox v-model="paychannel.ali_open" class="ali_open" label="支付宝官方：" @change="handleDialogCheckSelect"></el-checkbox>
                <el-input :disabled="true" class="w100" :maxlength="5" v-model.number="paychannel.ali"></el-input>%
                <p v-if="roles[0] !== 0" class="err">Tips：如需修改，请向上级申请！</p>
              </el-form-item>
              <el-form-item v-if="active === '网商银行'" prop="ws_wx">
                <el-checkbox v-model="paychannel.ws_wx_open" class="ws_wx_open" label="微信通道：" @change="handleDialogCheckSelect"></el-checkbox>
                <el-input :disabled="roles[0] === 0 ? false : true" class="w100" :maxlength="5" v-model.number="paychannel.ws_wx"></el-input>%
              </el-form-item>
              <el-form-item v-if="active === '网商银行'" prop="ws_ali">
                <el-checkbox v-model="paychannel.ws_ali_open" class="ws_ali_open" label="支付宝通道：" @change="handleDialogCheckSelect"></el-checkbox>
                <el-input :disabled="roles[0] === 0 ? false : true" class="w100" :maxlength="5" v-model.number="paychannel.ws_ali"></el-input>%
                <p v-if="roles[0] !== 0" class="err">Tips：如需修改，请向上级申请！</p>
              </el-form-item>
              <el-form-item v-if="active === '富民银行'" prop="fu_wx">
                <el-checkbox v-model="paychannel.fu_wx_open" class="fu_wx_open" label="微信通道：" @change="handleDialogCheckSelect"></el-checkbox>
                <el-input :disabled="roles[0] === 0 ? false : true" class="w100" :maxlength="5" v-model.number="paychannel.fu_wx"></el-input>%
              </el-form-item>
              <el-form-item v-if="active === '富民银行'" prop="fu_ali">
                <el-checkbox v-model="paychannel.fu_ali_open" class="fu_ali_open" label="支付宝通道：" @change="handleDialogCheckSelect"></el-checkbox>
                <el-input :disabled="roles[0] === 0 ? false : true" class="w100" :maxlength="5" v-model.number="paychannel.fu_ali"></el-input>%
                <p v-if="roles[0] !== 0" class="err">Tips：如需修改，请向上级申请！</p>
              </el-form-item>
                <el-form-item v-if="active === '乐刷'">
                  <el-checkbox v-model="paychannel.le_wx_open" class="le_wx_open" label="D+0" @change="handleDialogCheckSelect"></el-checkbox>
                </el-form-item>
                <el-form-item v-if="active === '乐刷'" label="微信通道：" prop="le_wx_t0">
                  <el-input class="w100" :maxlength="5" v-model.number="paychannel.le_wx_t0"></el-input>%
                </el-form-item>
                <el-form-item v-if="active === '乐刷'" label="支付宝通道：" prop="le_ali_t0">
                  <el-input class="w100" :maxlength="5" v-model.number="paychannel.le_ali_t0"></el-input>%
                </el-form-item>
                <el-form-item v-if="active === '乐刷'">
                  <el-checkbox v-model="paychannel.le_ali_open" class="le_ali_open" label="D+1" @change="handleDialogCheckSelect"></el-checkbox>
                </el-form-item>
                <el-form-item v-if="active === '乐刷'" label="微信通道" prop="le_wx_t1">
                  <el-input class="w100" :maxlength="5" v-model.number="paychannel.le_wx_t1"></el-input>%
                </el-form-item>
                <el-form-item v-if="active === '乐刷'" label="支付宝通道：" prop="le_ali_t1">
                  <el-input class="w100" :maxlength="5" v-model.number="paychannel.le_ali_t1"></el-input>%
                </el-form-item>
              <el-form-item v-if="active === '新大陆'" prop="xdl_scan">
                <div style="display: inline-block;vertical-align:middle;">
                  <el-checkbox v-model="paychannel.xdl_wx_open" class="xdl_wx_open" label="微信通道" @change="handleDialogCheckSelect"></el-checkbox><br/>
                  <el-checkbox v-model="paychannel.xdl_ali_open" class="xdl_ali_open" label="支付宝通道" @change="handleDialogCheckSelect"></el-checkbox>
                </div>
                <el-input class="w100" :maxlength="5" v-model.number="paychannel.xdl_scan" style="vertical-align: middle;"></el-input>%
              </el-form-item>
              <el-form-item v-if="active === '新大陆'" prop="xdl_norm">
                <el-checkbox v-model="paychannel.xdl_norm_open" label="银联二维码标准："></el-checkbox>
                <el-input class="w100" :maxlength="5" v-model.number="paychannel.xdl_norm"></el-input>%<span class="err">（收款金额≥1000元）</span>
              </el-form-item>
              <el-form-item v-if="active === '新大陆'" style="padding-left: 25px;" prop="xdl_off">
                <span>银联二维码优惠：</span>
                <el-input class="w100" :maxlength="5" v-model.number="paychannel.xdl_off"></el-input>%<span class="err">（收款金额&lt;1000元）</span>
              </el-form-item>
            </el-form>
          </el-col>
        </el-row>
      </el-tab-pane>
      <el-tab-pane label="刷卡支付通道" ref="pos">
        <p class="fz12">当前已选：</p>
        <p>
          <span class="fz12 mr20">POS机刷卡：<span class="tip">{{ POSChannel.le_d0_active ? '乐刷D+0' : POSChannel.le_d1_active ? '乐刷D+1' : POSChannel.xdl_active ? '新大陆' : '无' }}</span></span>
        </p>
        <el-row class="mt20">
          <el-col :span="6">
            <el-menu @select="handDialogPosMenuActive">
              <el-menu-item v-for="item in PosMenu" :key="item.b_channel_text" :index="item.b_channel_text">
                <svg-icon style="width: 20px;height:20px;vertical-align: middle;" :icon-class="item.b_channel_text === '微信官方' ? 'weixin' : item.b_channel_text === '支付宝官方' ? 'zhifubao' : item.b_channel_text === '网商银行' ? 'wangshang' : item.b_channel_text === '富民银行' ? 'gen' : item.b_channel_text === '乐刷' ? 'le' : item.b_channel_text === '新大陆' ? 'xindalu' : ''"></svg-icon>
                <span>{{ item.b_channel_text }}</span>
              </el-menu-item>
            </el-menu>
          </el-col>
          <el-col :span="17" :offset="1">
            <el-form :model="poschannel" size="mini" :rules="pos_rules" :show-message="false" ref="posForm">
                <el-form-item v-if="posActive === '乐刷'">
                  <el-checkbox v-model="POSChannel.le_d0_active" class="pos_le_d0_open" label="D+0" @change="handleDialogCheckSelect"></el-checkbox>
                </el-form-item>
                <el-form-item v-if="posActive === '乐刷'" label="借记卡D+0：" prop="debit_d0">
                  <el-input :disabled="roles[0] === 0 ? false : true" class="w100" :maxlength="5" v-model.number="poschannel.debit_d0"></el-input>%
                </el-form-item>
                <el-form-item v-if="posActive === '乐刷'" label="贷记卡D+0：" prop="credit_d0">
                  <el-input :disabled="roles[0] === 0 ? false : true" class="w100" :maxlength="5" v-model.number="poschannel.credit_d0"></el-input>%
                </el-form-item>
                <el-form-item v-if="posActive === '乐刷'" label="境外卡D+0：" prop="ovsea_d0">
                  <el-input :disabled="roles[0] === 0 ? false : true" class="w100" :maxlength="5" v-model.number="poschannel.ovsea_d0"></el-input>%
                </el-form-item>
                <el-form-item v-if="posActive === '乐刷'">
                  <el-checkbox v-model="POSChannel.le_d1_active" class="pos_le_d1_open" label="D+1" @change="handleDialogCheckSelect"></el-checkbox>
                </el-form-item>
                <el-form-item v-if="posActive === '乐刷'" label="借记卡D+1：" prop="debit_d1">
                  <el-input :disabled="roles[0] === 0 ? false : true" class="w100" :maxlength="5" v-model.number="poschannel.debit_d1"></el-input>%
                </el-form-item>
                <el-form-item v-if="posActive === '乐刷'" label="借记卡D+1封顶：" prop="ceiling">
                  <el-input :disabled="roles[0] === 0 ? false : true" class="w100" v-model.number="poschannel.ceiling"></el-input>元
                </el-form-item>
                <el-form-item v-if="posActive === '乐刷'" label="贷记卡D+1：" prop="credit_d1">
                  <el-input :disabled="roles[0] === 0 ? false : true" class="w100" :maxlength="5" v-model.number="poschannel.credit_d1"></el-input>%
                </el-form-item>
                <el-form-item v-if="posActive === '乐刷'" label="境外卡D+1：" prop="ovsea_d1">
                  <el-input :disabled="roles[0] === 0 ? false : true" class="w100" :maxlength="5" v-model.number="poschannel.ovsea_d1"></el-input>%
                  <p v-if="roles[0] !== 0" class="err">Tips：如需修改，请向上级申请！</p>
                </el-form-item>
                <el-form-item v-if="posActive === '新大陆'" prop="xdl_scan">
                  <el-checkbox v-model="POSChannel.xdl_active" class="pos_xdl_open" label="启用本通道" @change="handleDialogCheckSelect"></el-checkbox><br/>
                </el-form-item>
                <el-form-item v-if="posActive === '新大陆'" label="借记卡费率：" prop="xdl_credit">
                  <el-input class="w100" :maxlength="5" v-model.number="poschannel.xdl_credit"></el-input>%
                </el-form-item>
                <el-form-item v-if="posActive === '新大陆'" label="封顶金额：" prop="pos_debit_max">
                  <el-input class="w100" :maxlength="5" v-model.number="poschannel.pos_debit_max"></el-input>元
                </el-form-item>
                <el-form-item v-if="posActive === '新大陆'" label="贷记卡费率：" prop="xdl_debit">
                  <el-input class="w100" :maxlength="5" v-model.number="poschannel.xdl_debit"></el-input>%
                </el-form-item>
            </el-form>
          </el-col>
        </el-row>
      </el-tab-pane>
    </el-tabs>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  data() {
    return {
      active: null,
      posActive: null,
      paychannel: {
        wx_open: false,
        ali_open: false,
        ws_wx_open: false,
        ws_ali_open: false,
        fu_wx_open: false,
        fu_ali_open: false,
        le_wx_open: false,
        le_ali_open: false,
        xdl_wx_open: false,
        xdl_ali_open: false,
        xdl_norm_open: false,
        xdl_off_open: false,
        wx: '',
        ali: '',
        ws_wx: '',
        ws_ali: '',
        fu_wx: '',
        fu_ali: '',
        le_wx_t0: '',
        le_ali_t0: '',
        le_wx_t1: '',
        le_ali_t1: '',
        xdl_scan: '',
        xdl_ali: '',
        xdl_norm: '',
        xdl_off: ''
      },
      POSChannel: {
        le_d0_active: false,
        le_d1_active: false,
        xdl_active: false
      },
      poschannel: {
        debit_d0: '',
        debit_d1: '',
        credit_d0: '',
        credit_d1: '',
        ceiling: '',
        ovsea_d0: '',
        ovsea_d1: '',
        xdl_credit: '',
        xdl_debit: '',
        pos_debit_max: ''
      },
      rules: {
        wx: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }],
        ali: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }],
        ws_wx: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }],
        ws_ali: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }],
        fu_ali: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }],
        fu_wx: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }],
        le_wx_t0: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }],
        le_ali_t1: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }],
        le_wx_t1: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }],
        le_ali_t0: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }],
        xdl_scan: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }],
        xdl_norm: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }],
        xdl_off: [{ required: true, trigger: 'blur', type: 'number', message: '必须填写~' }]
      },
      pos_rules: {
        ovsea_d1: [{ required: true, type: 'number', trigger: 'blur' }],
        ovsea_d0: [{ required: true, type: 'number', trigger: 'blur' }],
        debit_d0: [{ required: true, type: 'number', trigger: 'blur' }],
        debit_d1: [{ required: true, type: 'number', trigger: 'blur' }],
        credit_d0: [{ required: true, type: 'number', trigger: 'blur' }],
        credit_d1: [{ required: true, type: 'number', trigger: 'blur' }],
        xdl_credit: [{ required: true, type: 'number', trigger: 'blur' }],
        xdl_debit: [{ required: true, type: 'number', trigger: 'blur' }],
        ceiling: [{ required: true, type: 'number', trigger: 'blur' }],
        pos_debit_max: [{ required: true, type: 'number', trigger: 'blur' }]
      }
    }
  },
  props: {
    menu: {
      required: true,
      type: Array
    },
    PosMenu: {
      required: true,
      type: Array
    },
    merchant_num: {
      required: true
    }
  },
  computed: {
    ...mapGetters([
      'roles'
    ])
  },
  methods: {
    handleDocumentInit() {
      for (let i = 0; i < this.menu.length; i++) {
        if (this.menu[i].b_channel_text === '微信官方') {
          this.menu[i].c_channel.forEach(v => {
            this.paychannel.wx = Number(v.rate)
            v.open_status === 100 ? this.paychannel.wx_open = false : this.paychannel.wx_open = true
          })
        } else if (this.menu[i].b_channel_text === '支付宝官方') {
          this.menu[i].c_channel.forEach(v => {
            this.paychannel.ali = Number(v.rate)
            v.open_status === 100 ? this.paychannel.ali_open = false : this.paychannel.ali_open = true
          })
        } else if (this.menu[i].b_channel_text === '网商银行') {
          this.menu[i].c_channel.forEach(v => {
            if (v.c_channel === 1) { this.paychannel.ws_wx = Number(v.rate); v.open_status === 100 ? this.paychannel.ws_wx_open = false : this.paychannel.ws_wx_open = true }
            if (v.c_channel === 2) { this.paychannel.ws_ali = Number(v.rate); v.open_status === 100 ? this.paychannel.ws_ali_open = false : this.paychannel.ws_ali_open = true }
          })
        } else if (this.menu[i].b_channel_text === '富民银行') {
          this.menu[i].c_channel.forEach(v => {
            if (v.c_channel === 1) { this.paychannel.fu_wx = Number(v.rate); v.open_status === 100 ? this.paychannel.fu_wx_open = false : this.paychannel.fu_wx_open = true }
            if (v.c_channel === 2) { this.paychannel.fu_ali = Number(v.rate); v.open_status === 100 ? this.paychannel.fu_ali_open = false : this.paychannel.fu_ali_open = true }
          })
        } else if (this.menu[i].b_channel_text === '乐刷') {
          this.menu[i].balance_type === 100 ? this.paychannel.le_wx_open = true : this.menu[i].balance_type === 200 ? this.paychannel.le_ali_open = true : ''
          this.menu[i].c_channel.forEach(v => {
            if (v.c_channel === 1) { this.paychannel.le_wx_t0 = Number(v.rate.t0); this.paychannel.le_wx_t1 = Number(v.rate.t1) }
            if (v.c_channel === 2) { this.paychannel.le_ali_t0 = Number(v.rate.t0); this.paychannel.le_ali_t1 = Number(v.rate.t1) }
          })
        } else if (this.menu[i].b_channel_text === '新大陆') {
          this.menu[i].c_channel.forEach(v => {
            if (v.c_channel === 1) { this.paychannel.xdl_scan = Number(v.rate.scan); v.open_status === 100 ? this.paychannel.xdl_wx_open = false : this.paychannel.xdl_wx_open = true }
            if (v.c_channel === 2) { this.paychannel.xdl_ali = Number(v.rate.scan); v.open_status === 100 ? this.paychannel.xdl_ali_open = false : this.paychannel.xdl_ali_open = true }
            if (v.c_channel === 5) { this.paychannel.xdl_norm = Number(v.rate.unionpay_sta); this.paychannel.xdl_off = Number(v.rate.unionpay_dis); v.open_status === 100 ? this.paychannel.xdl_norm_open = false : this.paychannel.xdl_norm_open = true }
          })
        }
      }
    },
    handleDocumentInitPos(data) {
      for (let j = 0; j < data.length; j++) {
        if (data[j].b_channel_text === '乐刷') {
          data[j].pos_channel_text === 200 ? this.POSChannel.le_d1_active = true : data[j].pos_channel_text === 100 ? this.POSChannel.le_d0_active = true : ''
          data[j].c_channel.forEach(v => {
            this.poschannel.credit_d0 = Number(v.pos_rates.credit.d0.rate)
            this.poschannel.credit_d1 = Number(v.pos_rates.credit.d1.rate)
            this.poschannel.ceiling = Number(v.pos_rates.debit.d1.ceiling)
            this.poschannel.debit_d1 = Number(v.pos_rates.debit.d1.rate)
            this.poschannel.debit_d0 = Number(v.pos_rates.debit.d0.rate)
            this.poschannel.ovsea_d0 = Number(v.pos_rates.ovsea.d0.rate)
            this.poschannel.ovsea_d1 = Number(v.pos_rates.ovsea.d1.rate)
          })
        }
        if (data[j].b_channel_text === '新大陆') {
          data[j].c_channel.forEach(v => {
            this.poschannel.xdl_credit = Number(v.pos_rates.credit)
            this.poschannel.xdl_debit = Number(v.pos_rates.debit)
            this.poschannel.pos_debit_max = Number(v.pos_rates.pos_debit_max)
            v.open_status === 200 ? this.POSChannel.xdl_active = true : this.POSChannel.xdl_active = false
          })
        }
      }
    },
    handleDialogCheckSelect(v, type) {
      switch (type.target.labels[0].className) {
        case 'el-checkbox wx_open':
          if (v) {
            this.paychannel.ws_wx_open = false
            this.paychannel.fu_wx_open = false
            this.paychannel.le_wx_open = false
            this.paychannel.le_ali_open = false
            this.paychannel.xdl_wx_open = false
          }
          break
        case 'el-checkbox ali_open':
          if (v) {
            this.paychannel.ws_ali_open = false
            this.paychannel.fu_ali_open = false
            this.paychannel.le_ali_open = false
            this.paychannel.le_wx_open = false
            this.paychannel.xdl_ali_open = false
          }
          break
        case 'el-checkbox ws_wx_open':
          if (v) {
            this.paychannel.wx_open = false
            this.paychannel.fu_wx_open = false
            this.paychannel.le_ali_open = false
            this.paychannel.le_wx_open = false
            this.paychannel.xdl_wx_open = false
          }
          break
        case 'el-checkbox fu_wx_open':
          if (v) {
            this.paychannel.wx_open = false
            this.paychannel.ws_wx_open = false
            this.paychannel.le_ali_open = false
            this.paychannel.le_wx_open = false
            this.paychannel.xdl_wx_open = false
          }
          break
        case 'el-checkbox le_wx_open':
          if (v) {
            this.paychannel.le_ali_open = false
            this.paychannel.wx_open = false
            this.paychannel.ali_open = false
            this.paychannel.fu_wx_open = false
            this.paychannel.fu_ali_open = false
            this.paychannel.ws_wx_open = false
            this.paychannel.ws_ali_open = false
            this.paychannel.xdl_wx_open = false
            this.paychannel.xdl_ali_open = false
          }
          break
        case 'el-checkbox xdl_wx_open':
          if (v) {
            this.paychannel.wx_open = false
            this.paychannel.fu_wx_open = false
            this.paychannel.le_ali_open = false
            this.paychannel.le_wx_open = false
            this.paychannel.ws_wx_open = false
          }
          break
        case 'el-checkbox ws_ali_open':
          if (v) {
            this.paychannel.ali_open = false
            this.paychannel.fu_ali_open = false
            this.paychannel.le_ali_open = false
            this.paychannel.le_wx_open = false
            this.paychannel.xdl_ali_open = false
          }
          break
        case 'el-checkbox fu_ali_open':
          if (v) {
            this.paychannel.ws_ali_open = false
            this.paychannel.ali_open = false
            this.paychannel.le_ali_open = false
            this.paychannel.le_wx_open = false
            this.paychannel.xdl_ali_open = false
          }
          break
        case 'el-checkbox le_ali_open':
          if (v) {
            this.paychannel.le_wx_open = false
            this.paychannel.ws_ali_open = false
            this.paychannel.ws_wx_open = false
            this.paychannel.fu_ali_open = false
            this.paychannel.fu_wx_open = false
            this.paychannel.ali_open = false
            this.paychannel.wx_open = false
            this.paychannel.xdl_ali_open = false
            this.paychannel.xdl_wx_open = false
          }
          break
        case 'el-checkbox xdl_ali_open':
          if (v) {
            this.paychannel.ws_ali_open = false
            this.paychannel.fu_ali_open = false
            this.paychannel.le_ali_open = false
            this.paychannel.le_wx_open = false
            this.paychannel.ali_open = false
          }
          break
        case 'el-checkbox pos_xdl_open':
          if (v) {
            this.POSChannel.le_d1_active = false
            this.POSChannel.le_d0_active = false
          }
          break
        case 'el-checkbox pos_le_d0_open':
          if (v) {
            this.POSChannel.le_d1_active = false
            this.POSChannel.xdl_active = false
          }
          break
        case 'el-checkbox pos_le_d1_open':
          if (v) {
            this.POSChannel.le_d0_active = false
            this.POSChannel.xdl_active = false
          }
          break
      }
    },
    handDialogMenuActive(v) {
      this.active = v
    },
    handDialogPosMenuActive(v) {
      this.posActive = v
    },
    handleChangeTabs(v) {
      this.$emit('tabUpdate', v)
    },
    handleValidMoible() {
      return new Promise((resolve, reject) => {
        this.$refs['model'].validate((valid) => {
          resolve({ valid, id: this.merchant_num })
        })
      })
    },
    handleValidPos() {
      return new Promise((resolve, reject) => {
        this.$refs['posForm'].validate((valid) => {
          resolve({ valid, id: this.merchant_num })
        })
      })
    }
  },
  watch: {
    PosMenu: {
      handler(n, o) {
        this.handleDocumentInitPos(n)
      }
    },
    deep: true
  },
  mounted() {
    this.handleDocumentInit()
    this.handleDocumentInitPos(this.PosMenu)
  }
}
</script>